<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Request;
use think\facade\Config;//引入配置

class Index extends Controller
{   

    private $redis;
   
    public function index()
    {  
      $this->redis = new \Redis();
      $this->redis->connect(config('app.redis_ip'), 6379);
      $this->redis->auth(config('app.redis_Secret'));
      
      //删除tablename
      $product=Db::table('lily_products')->field('id,part_number,url_product')->select()->toArray();
      foreach ($product as $key => $value) {
          $this->redis->set($value['part_number'].$value['id'],$value['url_product']);
      }
    }
}